-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GHSA-gmj6-6f8f-6699] Jinja has a sandbox breakout through malicious filenames #5150
[GHSA-gmj6-6f8f-6699] Jinja has a sandbox breakout through malicious filenames #5150
Conversation
Hi there @davidism! A community member has suggested an improvement to your security advisory. If approved, this change will affect the global advisory listed at github.com/advisories. It will not affect the version listed in your project repository. This change will be reviewed by our Security Curation Team. If you have thoughts or feedback, please share them in a comment here! If this PR has already been closed, you can start a new community contribution for this advisory |
@@ -29,7 +25,7 @@ | |||
"type": "ECOSYSTEM", | |||
"events": [ | |||
{ | |||
"introduced": "0" | |||
"introduced": "3.0.0a1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't bother with alpha versions here, just use 3.0.0.
"published": "2024-12-23T17:54:12Z", | ||
"aliases": [ | ||
"CVE-2024-56201" | ||
], | ||
"summary": "Jinja has a sandbox breakout through malicious filenames", | ||
"details": "A bug in the Jinja compiler allows an attacker that controls both the content and filename of a template to execute arbitrary Python code, regardless of if Jinja's sandbox is used.\n\nTo exploit the vulnerability, an attacker needs to control both the filename and the contents of a template. Whether that is the case depends on the type of application using Jinja. This vulnerability impacts users of applications which execute untrusted templates where the template author can also choose the template filename.", | ||
"details": "A bug in the Jinja compiler allows an attacker that controls both the content and filename of a template to execute arbitrary Python code, regardless of if Jinja's sandbox is used.\n\nTo exploit the vulnerability, an attacker needs to control both the filename and the contents of a template. Whether that is the case depends on the type of application using Jinja. This vulnerability impacts users of applications which execute untrusted templates where the template author can also choose the template filename.\n\nJinja before 3.0.0a1 is not vulnerable as it does not use f-strings for formatting error messages.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't include version information here, it's already explained by the version information fields.
948059d
into
frenzymadness/advisory-improvement-5150
Hi @frenzymadness! Thank you so much for contributing to the GitHub Advisory Database. This database is free, open, and accessible to all, and it's people like you who make it great. Thanks for choosing to help others. We hope you send in more contributions in the future! |
Thank you @frenzymadness and @davidism for the clarification on which versions are affected. I've updated GHSA-gmj6-6f8f-6699 and the CVE record for CVE-2024-56201 to indicate that only 3.x versions are vulnerable. https://www.cve.org/CVERecord?id=CVE-2024-56201 has the current information but it will take some time for the updated information to propagate to https://nvd.nist.gov/vuln/detail/CVE-2024-56201. |
Updates
Comments
Jinja2 before the release 3.0.0a1 didn't use f-strings for the error message which means version 2 should not be vulnerable.
The code in the vulnerable release 3.4.1 is:
so if the content of
self.position(node)
is something like{bad}
, it might then be interpreted as an f-string.However, the code in the latest 2.11.3 is:
Which means that if the
self.position(node)
contains something with%
like%sbad%s
, it results inTypeError: not enough arguments for format string
because in the old-style formatting, there is no way to access variables by their names or run a code.